package com.anjie.powerproject.config;

import com.anjie.powerproject.schedule.DynamicPropertySchedule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.stereotype.Component;

@Component
public class ScheduleConfig implements SchedulingConfigurer {

    @Autowired
    DynamicPropertySchedule dynamicPropertySchedule;

    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        // todo 从ini文件中读取定时参数，在修改文件之后，通过重新调用这个方法来重新设置定时任务的参数
//        String cron = "0 0/1 * * * ?";
//
//        taskRegistrar.addCronTask(new Runnable() {
//            @Override
//            public void run() {
//                dynamicPropertySchedule.excute();
//            }
//        }, cron);
    }
}
